package cn.edu.scau.cmi.yangqing.factory;

import java.net.URL;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.ResourceBundle;

import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.TextField;

public class SimpleFactoryController implements Initializable {

	   @FXML
	   private Button myButton;

	   @FXML
	   private ChoiceBox<String> myChoiceBox;

	   @FXML
	   private TextField myTextField2;
	   public void initialize(URL location, ResourceBundle resources) {

	   }

	   public void showDateTime2(ActionEvent event) {
	       System.out.println("Button Clicked!");
	       System.out.println(myChoiceBox.getSelectionModel().getSelectedIndex());
	       Integer checkboxIndex = myChoiceBox.getSelectionModel().getSelectedIndex();
	       InsuranceFactory factory = new InsuranceFactory();
	       Insurance insurance =  factory.getInsuranceObj(checkboxIndex);
	       String output = insurance.getInsurance();
	       myTextField2.setText(output);
	   }
}
